package cn.meibang.meibanguserskillstype.provider.base;



import cn.meibang.meibanguserskillstype.provider.domain.MeibangUserSkillsType;

import static org.apache.ibatis.jdbc.SqlBuilder.*;

/**
 * 技师技能细类型 Dao 层
 *
 * @author yudw
 * @version 1.0
 */

public class BaseMeibangUserSkillsTypeSqlProvider implements java.io.Serializable {


    public String insertSelective(MeibangUserSkillsType record) {
        BEGIN();
        INSERT_INTO("meibang_user_skills_type");
        insertKey(record);
        return SQL();
    }

    public void insertKey(MeibangUserSkillsType record) {

        if (record.getType() != null) {
            VALUES("type", "#{type,jdbcType=VARCHAR}");
        }
        if (record.getLevel() != null) {
            VALUES("level", "#{level,jdbcType=VARCHAR}");
        }
        if (record.getLevel1() != null) {
            VALUES("level1", "#{level1,jdbcType=VARCHAR}");
        }
        if (record.getSkills() != null) {
            VALUES("skills", "#{skills,jdbcType=VARCHAR}");
        }
        if (record.getUserId() != null) {
            VALUES("user_id", "#{userId,jdbcType=BIGINT}");
        }
        if (record.getRemark() != null) {
            VALUES("remark", "#{remark,jdbcType=VARCHAR}");
        }
        if (record.getCreateDate() != null) {
            VALUES("create_date", "#{createDate,jdbcType=DATE}");
        }
        if (record.getUpdateDate() != null) {
            VALUES("update_date", "#{updateDate,jdbcType=DATE}");
        }
        if (record.getCreateBy() != null) {
            VALUES("create_by", "#{createBy,jdbcType=BIGINT}");
        }
        if (record.getUpdateBy() != null) {
            VALUES("update_by", "#{updateBy,jdbcType=BIGINT}");
        }
        if (record.getDelFlag() != null) {
            VALUES("del_flag", "#{delFlag,jdbcType=VARCHAR}");
        }
    }

    public String updateByPrimaryKeySelective(MeibangUserSkillsType record) {
        BEGIN();
        UPDATE("meibang_user_skills_type");
        updateKey(record);
        WHERE("id = #{id,jdbcType=BIGINT}");
        return SQL();
    }

    public void updateKey(MeibangUserSkillsType record) {
        if (record.getId() != null) {
            SET("id = #{id,jdbcType=BIGINT}");
        }
        if (record.getType() != null) {
            SET("type = #{type,jdbcType=VARCHAR}");
        }
        if (record.getLevel() != null) {
            SET("level = #{level,jdbcType=VARCHAR}");
        }
        if (record.getLevel1() != null) {
            SET("level1 = #{level1,jdbcType=VARCHAR}");
        }
        if (record.getSkills() != null) {
            SET("skills = #{skills,jdbcType=VARCHAR}");
        }
        if (record.getUserId() != null) {
            SET("user_id = #{userId,jdbcType=BIGINT}");
        }
        if (record.getRemark() != null) {
            SET("remark = #{remark,jdbcType=VARCHAR}");
        }
        if (record.getCreateDate() != null) {
            SET("create_date = #{createDate,jdbcType=DATE}");
        }
        if (record.getUpdateDate() != null) {
            SET("update_date = #{updateDate,jdbcType=DATE}");
        }
        if (record.getCreateBy() != null) {
            SET("create_by = #{createBy,jdbcType=BIGINT}");
        }
        if (record.getUpdateBy() != null) {
            SET("update_by = #{updateBy,jdbcType=BIGINT}");
        }
        if (record.getDelFlag() != null) {
            SET("del_flag = #{delFlag,jdbcType=VARCHAR}");
        }
    }
}